1. /* slflfact.cpp by K.Tsuru */
  2. // function ID = 2001 DRADIX(reference)
  3. /****************************************************************************
  4. SLong class
  5. It provides the factrial n! using the SLong arithmetic. It is very slow in
  6. comparison with FactPF() in which the prime factorization is used.
  7. ****************************************************************************/
  8. #ifndef SN_H
  9. #include "sn.h"
  10. #endif
  11. SLong LFact(ulong n){
  12. //the number of figure by Stirling's formula in the decimal system
  13. long sn = Stirling(n);
  14. long fig = sn/DFIGURES; //in the radix DRADIX
  15. if(sn % DFIGURES) fig++;
  16. SLong result(SNumber::DEC_INT, (uint)fig, 1.0); // result = 1
  17. ulong j;
  18. for(j = 2uL; j <= n; j++) result = LsMult(result, j);
  19. return result;
  20. }

slflfact.cpp : last modifiled at 2017/03/17 11:10:48(780 bytes)
created at 2017/10/07 10:26:49
The creation time of this html file is 2017/11/09 14:52:03 (Thu Nov 09 14:52:03 2017).